<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>mxCodec</title><link rel="stylesheet" type="text/css" href="../../styles/main.css"><script language=JavaScript src="../../javascript/main.js"></script><script language=JavaScript src="../../javascript/prettify.js"></script><script language=JavaScript src="../../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.51 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="mxCodec"></a>mxCodec</h1><div class=CBody><p>XML codec for JavaScript object graphs.&nbsp; See <a href="mxObjectCodec-js.html#mxObjectCodec" class=LClass id=link25 onMouseOver="ShowTip(event, 'tt21', 'link25')" onMouseOut="HideTip('tt21')">mxObjectCodec</a> for a description of the general encoding/decoding scheme.&nbsp; This class uses the codecs registered in <a href="mxCodecRegistry-js.html#mxCodecRegistry" class=LClass id=link26 onMouseOver="ShowTip(event, 'tt22', 'link26')" onMouseOut="HideTip('tt22')">mxCodecRegistry</a> for encoding/decoding each object.</p><h4 class=CHeading>References</h4><p>In order to resolve references, especially forward references, the mxCodec constructor must be given the document that contains the referenced elements.</p><h4 class=CHeading>Examples</h4><p>The following code is used to encode a graph model.</p><blockquote><pre class="prettyprint">var encoder = new mxCodec();
var result = encoder.encode(graph.getModel());
var xml = mxUtils.getXml(result);</pre></blockquote><h4 class=CHeading>Example</h4><p>Using the code below, an XML document is decoded into an existing model.&nbsp; The document may be obtained using one of the functions in mxUtils for loading an XML file, eg.&nbsp; <a href="../util/mxUtils-js.html#mxUtils.get" class=LFunction id=link27 onMouseOver="ShowTip(event, 'tt23', 'link27')" onMouseOut="HideTip('tt23')">mxUtils.get</a>, or using <a href="../util/mxUtils-js.html#mxUtils.parseXml" class=LFunction id=link28 onMouseOver="ShowTip(event, 'tt24', 'link28')" onMouseOut="HideTip('tt24')">mxUtils.parseXml</a> for parsing an XML string.</p><blockquote><pre class="prettyprint">var doc = mxUtils.parseXml(xmlString);
var codec = new mxCodec(doc);
codec.decode(doc.documentElement, graph.getModel());</pre></blockquote><h4 class=CHeading>Example</h4><p>This example demonstrates parsing a list of isolated cells into an existing graph model.&nbsp; Note that the cells do not have a parent reference so they can be added anywhere in the cell hierarchy after parsing.</p><blockquote><pre class="prettyprint">var xml = '&lt;root&gt;&lt;mxCell id=&quot;2&quot; value=&quot;Hello,&quot; vertex=&quot;1&quot;&gt;&lt;mxGeometry x=&quot;20&quot; y=&quot;20&quot; width=&quot;80&quot; height=&quot;30&quot; as=&quot;geometry&quot;/&gt;&lt;/mxCell&gt;&lt;mxCell id=&quot;3&quot; value=&quot;World!&quot; vertex=&quot;1&quot;&gt;&lt;mxGeometry x=&quot;200&quot; y=&quot;150&quot; width=&quot;80&quot; height=&quot;30&quot; as=&quot;geometry&quot;/&gt;&lt;/mxCell&gt;&lt;mxCell id=&quot;4&quot; value=&quot;&quot; edge=&quot;1&quot; source=&quot;2&quot; target=&quot;3&quot;&gt;&lt;mxGeometry relative=&quot;1&quot; as=&quot;geometry&quot;/&gt;&lt;/mxCell&gt;&lt;/root&gt;';
var doc = mxUtils.parseXml(xml);
var codec = new mxCodec(doc);
var elt = doc.documentElement.firstChild;
var cells = [];

while (elt != null)
{
  cells.push(codec.decode(elt));
  elt = elt.nextSibling;
}

graph.addCells(cells);</pre></blockquote><h4 class=CHeading>Example</h4><p>Using the following code, the selection cells of a graph are encoded and the output is displayed in a dialog box.</p><blockquote><pre class="prettyprint">var enc = new mxCodec();
var cells = graph.getSelectionCells();
mxUtils.alert(mxUtils.getPrettyXml(enc.encode(cells)));</pre></blockquote><p>Newlines in the XML can be converted to &lt;br&gt;, in which case a &lsquo;&lt;br&gt;&rsquo; argument must be passed to <a href="../util/mxUtils-js.html#mxUtils.getXml" class=LFunction id=link29 onMouseOver="ShowTip(event, 'tt25', 'link29')" onMouseOut="HideTip('tt25')">mxUtils.getXml</a> as the second argument.</p><h4 class=CHeading>Debugging</h4><p>For debugging I/O you can use the following code to get the sequence of encoded objects:</p><blockquote><pre class="prettyprint">var oldEncode = mxCodec.prototype.encode;
mxCodec.prototype.encode = function(obj)
{
  mxLog.show();
  mxLog.debug('mxCodec.encode: obj='+mxUtils.getFunctionName(obj.constructor));

  return oldEncode.apply(this, arguments);
};</pre></blockquote><p>Note that the I/O system adds object codecs for new object automatically.&nbsp; For decoding those objects, the constructor should be written as follows:</p><blockquote><pre class="prettyprint">var MyObj = function(name)
{
  // ...
};</pre></blockquote><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#mxCodec" >mxCodec</a></td><td class=SDescription>XML codec for JavaScript object graphs. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#mxCodec.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.mxCodec" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">mxCodec</a></td><td class=SDescription>Constructs an XML encoder/decoder for the specified owner document.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#mxCodec.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.document" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">document</a></td><td class=SDescription>The owner document of the codec.</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#mxCodec.objects" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">objects</a></td><td class=SDescription>Maps from IDs to objects.</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.elements" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">elements</a></td><td class=SDescription>Lookup table for resolving IDs to elements.</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#mxCodec.encodeDefaults" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">encodeDefaults</a></td><td class=SDescription>Specifies if default values should be encoded. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#mxCodec.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.putObject" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">putObject</a></td><td class=SDescription>Assoiates the given object with the given ID and returns the given object.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.getObject" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">getObject</a></td><td class=SDescription>Returns the decoded object for the element with the specified ID in <a href="#mxCodec.document" class=LVariable id=link8 onMouseOver="ShowTip(event, 'tt2', 'link8')" onMouseOut="HideTip('tt2')">document</a>. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.lookup" id=link9 onMouseOver="ShowTip(event, 'tt8', 'link9')" onMouseOut="HideTip('tt8')">lookup</a></td><td class=SDescription>Hook for subclassers to implement a custom lookup mechanism for cell IDs. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.getElementById" id=link10 onMouseOver="ShowTip(event, 'tt9', 'link10')" onMouseOut="HideTip('tt9')">getElementById</a></td><td class=SDescription>Returns the element with the given ID from <a href="#mxCodec.document" class=LVariable id=link11 onMouseOver="ShowTip(event, 'tt2', 'link11')" onMouseOut="HideTip('tt2')">document</a>.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.updateElements" id=link12 onMouseOver="ShowTip(event, 'tt10', 'link12')" onMouseOut="HideTip('tt10')">updateElements</a></td><td class=SDescription>Returns the element with the given ID from <a href="#mxCodec.document" class=LVariable id=link13 onMouseOver="ShowTip(event, 'tt2', 'link13')" onMouseOut="HideTip('tt2')">document</a>.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.addElement" id=link14 onMouseOver="ShowTip(event, 'tt11', 'link14')" onMouseOut="HideTip('tt11')">addElement</a></td><td class=SDescription>Adds the given element to <a href="#mxCodec.elements" class=LVariable id=link15 onMouseOver="ShowTip(event, 'tt4', 'link15')" onMouseOut="HideTip('tt4')">elements</a> if it has an ID.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.getId" id=link16 onMouseOver="ShowTip(event, 'tt12', 'link16')" onMouseOut="HideTip('tt12')">getId</a></td><td class=SDescription>Returns the ID of the specified object. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.reference" id=link17 onMouseOver="ShowTip(event, 'tt13', 'link17')" onMouseOut="HideTip('tt13')">reference</a></td><td class=SDescription>Hook for subclassers to implement a custom method for retrieving IDs from objects. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.encode" id=link18 onMouseOver="ShowTip(event, 'tt14', 'link18')" onMouseOut="HideTip('tt14')">encode</a></td><td class=SDescription>Encodes the specified object and returns the resulting XML node.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.decode" id=link19 onMouseOver="ShowTip(event, 'tt15', 'link19')" onMouseOut="HideTip('tt15')">decode</a></td><td class=SDescription>Decodes the given XML node. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.encodeCell" id=link20 onMouseOver="ShowTip(event, 'tt16', 'link20')" onMouseOut="HideTip('tt16')">encodeCell</a></td><td class=SDescription>Encoding of cell hierarchies is built-into the core, but is a higher-level function that needs to be explicitely used by the respective object encoders (eg. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.isCellCodec" id=link21 onMouseOver="ShowTip(event, 'tt17', 'link21')" onMouseOut="HideTip('tt17')">isCellCodec</a></td><td class=SDescription>Returns true if the given codec is a cell codec. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.decodeCell" id=link22 onMouseOver="ShowTip(event, 'tt18', 'link22')" onMouseOut="HideTip('tt18')">decodeCell</a></td><td class=SDescription>Decodes cells that have been encoded using inversion, ie. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.insertIntoGraph" id=link23 onMouseOver="ShowTip(event, 'tt19', 'link23')" onMouseOut="HideTip('tt19')">insertIntoGraph</a></td><td class=SDescription>Inserts the given cell into its parent and terminal cells.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.setAttribute" id=link24 onMouseOver="ShowTip(event, 'tt20', 'link24')" onMouseOut="HideTip('tt20')">setAttribute</a></td><td class=SDescription>Sets the attribute on the specified node to value. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="mxCodec.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.mxCodec"></a>mxCodec</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function mxCodec(</td><td class="PParameter  prettyprint " nowrap>document</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs an XML encoder/decoder for the specified owner document.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>document</td><td class=CDLDescription>Optional XML document that contains the data.&nbsp; If no document is specified then a new document is created using <a href="../util/mxUtils-js.html#mxUtils.createXmlDocument" class=LFunction id=link30 onMouseOver="ShowTip(event, 'tt26', 'link30')" onMouseOut="HideTip('tt26')">mxUtils.createXmlDocument</a>.</td></tr></table></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="mxCodec.Variables"></a>Variables</h3></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.document"></a>document</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.document</td></tr></table></blockquote><p>The owner document of the codec.</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.objects"></a>objects</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.objects</td></tr></table></blockquote><p>Maps from IDs to objects.</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.elements"></a>elements</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.elements</td></tr></table></blockquote><p>Lookup table for resolving IDs to elements.</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.encodeDefaults"></a>encodeDefaults</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.encodeDefaults</td></tr></table></blockquote><p>Specifies if default values should be encoded.&nbsp; Default is false.</p></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="mxCodec.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.putObject"></a>putObject</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.putObject = function(</td><td class="PParameter  prettyprint " nowrap>id,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Assoiates the given object with the given ID and returns the given object.</p><p>Parameters</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>ID for the object to be associated with.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be associated with the ID.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.getObject"></a>getObject</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.getObject = function(</td><td class="PParameter  prettyprint " nowrap>id</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the decoded object for the element with the specified ID in <a href="#mxCodec.document" class=LVariable id=link31 onMouseOver="ShowTip(event, 'tt2', 'link31')" onMouseOut="HideTip('tt2')">document</a>.&nbsp; If the object is not known then <a href="#mxCodec.lookup" class=LFunction id=link32 onMouseOver="ShowTip(event, 'tt8', 'link32')" onMouseOut="HideTip('tt8')">lookup</a> is used to find an object.&nbsp; If no object is found, then the element with the respective ID from the document is parsed using <a href="#mxCodec.decode" class=LFunction id=link33 onMouseOver="ShowTip(event, 'tt15', 'link33')" onMouseOut="HideTip('tt15')">decode</a>.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.lookup"></a>lookup</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.lookup = function(</td><td class="PParameter  prettyprint " nowrap>id</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to implement a custom lookup mechanism for cell IDs.&nbsp; This implementation always returns null.</p><h4 class=CHeading>Example</h4><blockquote><pre class="prettyprint">var codec = new mxCodec();
codec.lookup = function(id)
{
  return model.getCell(id);
};</pre></blockquote><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>ID of the object to be returned.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.getElementById"></a>getElementById</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.getElementById = function(</td><td class="PParameter  prettyprint " nowrap>id</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the element with the given ID from <a href="#mxCodec.document" class=LVariable id=link34 onMouseOver="ShowTip(event, 'tt2', 'link34')" onMouseOut="HideTip('tt2')">document</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>String that contains the ID.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.updateElements"></a>updateElements</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.updateElements = function()</td></tr></table></blockquote><p>Returns the element with the given ID from <a href="#mxCodec.document" class=LVariable id=link35 onMouseOver="ShowTip(event, 'tt2', 'link35')" onMouseOut="HideTip('tt2')">document</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>String that contains the ID.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.addElement"></a>addElement</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.addElement = function(</td><td class="PParameter  prettyprint " nowrap>node</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds the given element to <a href="#mxCodec.elements" class=LVariable id=link36 onMouseOver="ShowTip(event, 'tt4', 'link36')" onMouseOut="HideTip('tt4')">elements</a> if it has an ID.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.getId"></a>getId</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.getId = function(</td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the ID of the specified object.&nbsp; This implementation calls <a href="#mxCodec.reference" class=LFunction id=link37 onMouseOver="ShowTip(event, 'tt13', 'link37')" onMouseOut="HideTip('tt13')">reference</a> first and if that returns null handles the object as an <a href="../model/mxCell-js.html#mxCell" class=LClass id=link38 onMouseOver="ShowTip(event, 'tt27', 'link38')" onMouseOut="HideTip('tt27')">mxCell</a> by returning their IDs using <a href="../model/mxCell-js.html#mxCell.getId" class=LFunction id=link39 onMouseOver="ShowTip(event, 'tt28', 'link39')" onMouseOut="HideTip('tt28')">mxCell.getId</a>.&nbsp; If no ID exists for the given cell, then an on-the-fly ID is generated using <a href="../model/mxCellPath-js.html#mxCellPath.create" class=LFunction id=link40 onMouseOver="ShowTip(event, 'tt29', 'link40')" onMouseOut="HideTip('tt29')">mxCellPath.create</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to return the ID for.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.reference"></a>reference</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.reference = function(</td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to implement a custom method for retrieving IDs from objects.&nbsp; This implementation always returns null.</p><h4 class=CHeading>Example</h4><blockquote><pre class="prettyprint">var codec = new mxCodec();
codec.reference = function(obj)
{
  return obj.getCustomId();
};</pre></blockquote><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object whose ID should be returned.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.encode"></a>encode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.encode = function(</td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Encodes the specified object and returns the resulting XML node.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be encoded.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.decode"></a>decode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.decode = function(</td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>into</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Decodes the given XML node.&nbsp; The optional &ldquo;into&rdquo; argument specifies an existing object to be used.&nbsp; If no object is given, then a new instance is created using the constructor from the codec.</p><p>The function returns the passed in object or the new instance if no object was given.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to be decoded.</td></tr><tr><td class=CDLEntry>into</td><td class=CDLDescription>Optional object to be decodec into.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.encodeCell"></a>encodeCell</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.encodeCell = function(</td><td class="PParameter  prettyprint " nowrap>cell,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>includeChildren</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Encoding of cell hierarchies is built-into the core, but is a higher-level function that needs to be explicitely used by the respective object encoders (eg.&nbsp; <a href="mxModelCodec-js.html#mxModelCodec" class=LClass id=link41 onMouseOver="ShowTip(event, 'tt30', 'link41')" onMouseOut="HideTip('tt30')">mxModelCodec</a>, <a href="mxChildChangeCodec-js.html#mxChildChangeCodec" class=LClass id=link42 onMouseOver="ShowTip(event, 'tt31', 'link42')" onMouseOut="HideTip('tt31')">mxChildChangeCodec</a> and <a href="mxRootChangeCodec-js.html#mxRootChangeCodec" class=LClass id=link43 onMouseOver="ShowTip(event, 'tt32', 'link43')" onMouseOut="HideTip('tt32')">mxRootChangeCodec</a>).&nbsp; This implementation writes the given cell and its children as a (flat) sequence into the given node.&nbsp; The children are not encoded if the optional includeChildren is false.&nbsp; The function is in charge of adding the result into the given node and has no return value.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>cell</td><td class=CDLDescription><a href="../model/mxCell-js.html#mxCell" class=LClass id=link44 onMouseOver="ShowTip(event, 'tt27', 'link44')" onMouseOut="HideTip('tt27')">mxCell</a> to be encoded.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>Parent XML node to add the encoded cell into.</td></tr><tr><td class=CDLEntry>includeChildren</td><td class=CDLDescription>Optional boolean indicating if the function should include all descendents.&nbsp; Default is true.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.isCellCodec"></a>isCellCodec</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.isCellCodec = function(</td><td class="PParameter  prettyprint " nowrap>codec</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given codec is a cell codec.&nbsp; This uses <a href="mxCellCodec-js.html#mxCellCodec.isCellCodec" class=LFunction id=link45 onMouseOver="ShowTip(event, 'tt33', 'link45')" onMouseOut="HideTip('tt33')">mxCellCodec.isCellCodec</a> to check if the codec is of the given type.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.decodeCell"></a>decodeCell</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.decodeCell = function(</td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>restoreStructures</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Decodes cells that have been encoded using inversion, ie. where the user object is the enclosing node in the XML, and restores the group and graph structure in the cells.&nbsp; Returns a new <a href="../model/mxCell-js.html#mxCell" class=LClass id=link46 onMouseOver="ShowTip(event, 'tt27', 'link46')" onMouseOut="HideTip('tt27')">mxCell</a> instance that represents the given node.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node that contains the cell data.</td></tr><tr><td class=CDLEntry>restoreStructures</td><td class=CDLDescription>Optional boolean indicating whether the graph structure should be restored by calling insert and insertEdge on the parent and terminals, respectively.&nbsp; Default is true.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.insertIntoGraph"></a>insertIntoGraph</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.insertIntoGraph = function(</td><td class="PParameter  prettyprint " nowrap>cell</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Inserts the given cell into its parent and terminal cells.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.setAttribute"></a>setAttribute</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.setAttribute = function(</td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>attribute,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>value</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the attribute on the specified node to value.&nbsp; This is a helper method that makes sure the attribute and value arguments are not null.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to set the attribute for.</td></tr><tr><td class=CDLEntry>attributes</td><td class=CDLDescription>Attributename to be set.</td></tr><tr><td class=CDLEntry>value</td><td class=CDLDescription>New value of the attribute.</td></tr></table></div></div></div>

</div><!--Content-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile><a href="../index-txt.html">API Specification</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Editor</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="../editor/mxDefaultKeyHandler-js.html">mxDefaultKeyHandler</a></div></div><div class=MEntry><div class=MFile><a href="../editor/mxDefaultPopupMenu-js.html">mxDefaultPopupMenu</a></div></div><div class=MEntry><div class=MFile><a href="../editor/mxDefaultToolbar-js.html">mxDefaultToolbar</a></div></div><div class=MEntry><div class=MFile><a href="../editor/mxEditor-js.html">mxEditor</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Handler</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="../handler/mxCellHighlight-js.html">mxCellHighlight</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxCellMarker-js.html">mxCellMarker</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxCellTracker-js.html">mxCellTracker</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxConnectionHandler-js.html">mxConnectionHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxConstraintHandler-js.html">mxConstraintHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxEdgeHandler-js.html">mxEdgeHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxEdgeSegmentHandler-js.html">mxEdgeSegmentHandler.js</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxElbowEdgeHandler-js.html">mxElbowEdgeHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxGraphHandler-js.html">mxGraphHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxHandle-js.html">mxHandle</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxKeyHandler-js.html">mxKeyHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxPanningHandler-js.html">mxPanningHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxPopupMenuHandler-js.html">mxPopupMenuHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxRubberband-js.html">mxRubberband</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxSelectionCellsHandler-js.html">mxSelectionCellsHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxTooltipHandler-js.html">mxTooltipHandler</a></div></div><div class=MEntry><div class=MFile><a href="../handler/mxVertexHandler-js.html">mxVertexHandler</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Io</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MFile><a href="mxCellCodec-js.html">mxCellCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxChildChangeCodec-js.html">mxChildChangeCodec</a></div></div><div class=MEntry><div class=MFile id=MSelected>mxCodec</div></div><div class=MEntry><div class=MFile><a href="mxCodecRegistry-js.html">mxCodecRegistry</a></div></div><div class=MEntry><div class=MFile><a href="mxDefaultKeyHandlerCodec-js.html">mxDefaultKeyHandlerCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxDefaultPopupMenuCodec-js.html">mxDefaultPopupMenuCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxDefaultToolbarCodec-js.html">mxDefaultToolbarCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxEditorCodec-js.html">mxEditorCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxGenericChangeCodec-js.html">mxGenericChangeCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxGraphCodec-js.html">mxGraphCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxGraphViewCodec-js.html">mxGraphViewCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxModelCodec-js.html">mxModelCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxObjectCodec-js.html">mxObjectCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxRootChangeCodec-js.html">mxRootChangeCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxStylesheetCodec-js.html">mxStylesheetCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxTerminalChangeCodec-js.html">mxTerminalChangeCodec</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent7')">Layout</a><div class=MGroupContent id=MGroupContent7><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent6')">Hierarchical</a><div class=MGroupContent id=MGroupContent6><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent4')">Model</a><div class=MGroupContent id=MGroupContent4><div class=MEntry><div class=MFile><a href="../layout/hierarchical/model/mxGraphAbstractHierarchyCell-js.html">mxGraphAbstractHierarchyCell</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/model/mxGraphHierarchyEdge-js.html">mxGraphHierarchyEdge</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/model/mxGraphHierarchyModel-js.html">mxGraphHierarchyModel</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/model/mxGraphHierarchyNode-js.html">mxGraphHierarchyNode</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/model/mxSwimlaneModel-js.html">mxSwimlaneModel</a></div></div></div></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/mxHierarchicalLayout-js.html">mxHierarchicalLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/mxSwimlaneLayout-js.html">mxSwimlaneLayout</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent5')">Stage</a><div class=MGroupContent id=MGroupContent5><div class=MEntry><div class=MFile><a href="../layout/hierarchical/stage/mxCoordinateAssignment-js.html">mxCoordinateAssignment</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/stage/mxHierarchicalLayoutStage-js.html">mxHierarchicalLayoutStage</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/stage/mxMedianHybridCrossingReduction-js.html">mxMedianHybridCrossingReduction</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/stage/mxMinimumCycleRemover-js.html">mxMinimumCycleRemover</a></div></div><div class=MEntry><div class=MFile><a href="../layout/hierarchical/stage/mxSwimlaneOrdering-js.html">mxSwimlaneOrdering</a></div></div></div></div></div></div></div></div><div class=MEntry><div class=MFile><a href="../layout/mxCircleLayout-js.html">mxCircleLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxCompactTreeLayout-js.html">mxCompactTreeLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxCompositeLayout-js.html">mxCompositeLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxEdgeLabelLayout-js.html">mxEdgeLabelLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxFastOrganicLayout-js.html">mxFastOrganicLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxGraphLayout-js.html">mxGraphLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxParallelEdgeLayout-js.html">mxParallelEdgeLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxPartitionLayout-js.html">mxPartitionLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxRadialTreeLayout-js.html">mxRadialTreeLayout</a></div></div><div class=MEntry><div class=MFile><a href="../layout/mxStackLayout-js.html">mxStackLayout</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent8')">Model</a><div class=MGroupContent id=MGroupContent8><div class=MEntry><div class=MFile><a href="../model/mxCell-js.html">mxCell</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxCellPath-js.html">mxCellPath</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxGeometry-js.html">mxGeometry</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxGraphModel-js.html">mxGraphModel</a></div></div></div></div></div><div class=MEntry><div class=MFile><a href="../mxClient-js.html">mxClient</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent9')">Shape</a><div class=MGroupContent id=MGroupContent9><div class=MEntry><div class=MFile><a href="../shape/mxActor-js.html">mxActor</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxArrow-js.html">mxArrow</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxArrowConnector-js.html">mxArrowConnector</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxCloud-js.html">mxCloud</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxConnector-js.html">mxConnector</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxCylinder-js.html">mxCylinder</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxDoubleEllipse-js.html">mxDoubleEllipse</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxEllipse-js.html">mxEllipse</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxHexagon-js.html">mxHexagon</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxImageShape-js.html">mxImageShape</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxLabel-js.html">mxLabel</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxLine-js.html">mxLine</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxMarker-js.html">mxMarker</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxPolyline-js.html">mxPolyline</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxRectangleShape-js.html">mxRectangleShape</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxRhombus-js.html">mxRhombus</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxShape-js.html">mxShape</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxStencil-js.html">mxStencil</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxStencilRegistry-js.html">mxStencilRegistry</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxSwimlane-js.html">mxSwimlane</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxText-js.html">mxText</a></div></div><div class=MEntry><div class=MFile><a href="../shape/mxTriangle-js.html">mxTriangle</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent10')">Util</a><div class=MGroupContent id=MGroupContent10><div class=MEntry><div class=MFile><a href="../util/mxAbstractCanvas2D-js.html">mxAbstractCanvas2D</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxAnimation-js.html">mxAnimation</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxAutoSaveManager-js.html">mxAutoSaveManager</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxClipboard-js.html">mxClipboard</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxConstants-js.html">mxConstants</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxDictionary-js.html">mxDictionary</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxDivResizer-js.html">mxDivResizer</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxDragSource-js.html">mxDragSource</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEffects-js.html">mxEffects</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEvent-js.html">mxEvent</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEventObject-js.html">mxEventObject</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEventSource-js.html">mxEventSource</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxForm-js.html">mxForm</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxGuide-js.html">mxGuide</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxImage-js.html">mxImage</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxImageBundle-js.html">mxImageBundle</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxImageExport-js.html">mxImageExport</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxLog-js.html">mxLog</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxMorphing-js.html">mxMorphing</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxMouseEvent-js.html">mxMouseEvent</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxObjectIdentity-js.html">mxObjectIdentity</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxPanningManager-js.html">mxPanningManager</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxPoint-js.html">mxPoint</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxPopupMenu-js.html">mxPopupMenu</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxRectangle-js.html">mxRectangle</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxResources-js.html">mxResources</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxSvgCanvas2D-js.html">mxSvgCanvas2D</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxToolbar-js.html">mxToolbar</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxUndoableEdit-js.html">mxUndoableEdit</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxUndoManager-js.html">mxUndoManager</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxUrlConverter-js.html">mxUrlConverter</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxUtils-js.html">mxUtils</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxVmlCanvas2D-js.html">mxVmlCanvas2D</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxWindow-js.html">mxWindow</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxXmlCanvas2D-js.html">mxXmlCanvas2D</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxXmlRequest-js.html">mxXmlRequest</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent11')">View</a><div class=MGroupContent id=MGroupContent11><div class=MEntry><div class=MFile><a href="../view/mxCellEditor-js.html">mxCellEditor</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxCellOverlay-js.html">mxCellOverlay</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxCellRenderer-js.html">mxCellRenderer</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxCellState-js.html">mxCellState</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxCellStatePreview-js.html">mxCellStatePreview</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxConnectionConstraint-js.html">mxConnectionConstraint</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxEdgeStyle-js.html">mxEdgeStyle</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxGraph-js.html">mxGraph</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxGraphSelectionModel-js.html">mxGraphSelectionModel</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxGraphView-js.html">mxGraphView</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxLayoutManager-js.html">mxLayoutManager</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxMultiplicity-js.html">mxMultiplicity</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxOutline-js.html">mxOutline</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxPerimeter-js.html">mxPerimeter</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxPrintPreview-js.html">mxPrintPreview</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxStyleRegistry-js.html">mxStyleRegistry</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxStylesheet-js.html">mxStylesheet</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxSwimlaneManager-js.html">mxSwimlaneManager</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxTemporaryCellStates-js.html">mxTemporaryCellStates</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent12')">Index</a><div class=MGroupContent id=MGroupContent12><div class=MEntry><div class=MIndex><a href="../../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Cookies.html">Cookies</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Events.html">Events</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Variables.html">Variables</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option  id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Cookies">Cookies</option><option value="Events">Events</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Variables">Variables</option></select></div><script language=JavaScript><!--
HideAllBut([3], 13);// --></script></div><!--Menu-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>function mxCodec(</td><td class="PParameter  prettyprint " nowrap>document</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Constructs an XML encoder/decoder for the specified owner document.</div></div><div class=CToolTip id="tt2"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.document</td></tr></table></blockquote>The owner document of the codec.</div></div><div class=CToolTip id="tt3"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.objects</td></tr></table></blockquote>Maps from IDs to objects.</div></div><div class=CToolTip id="tt4"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.elements</td></tr></table></blockquote>Lookup table for resolving IDs to elements.</div></div><div class=CToolTip id="tt5"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.encodeDefaults</td></tr></table></blockquote>Specifies if default values should be encoded. </div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.putObject = function(</td><td class="PParameter  prettyprint " nowrap>id,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Assoiates the given object with the given ID and returns the given object.</div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.getObject = function(</td><td class="PParameter  prettyprint " nowrap>id</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the decoded object for the element with the specified ID in document. </div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.lookup = function(</td><td class="PParameter  prettyprint " nowrap>id</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Hook for subclassers to implement a custom lookup mechanism for cell IDs. </div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.getElementById = function(</td><td class="PParameter  prettyprint " nowrap>id</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the element with the given ID from document.</div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCodec.prototype.updateElements = function()</td></tr></table></blockquote>Returns the element with the given ID from document.</div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.addElement = function(</td><td class="PParameter  prettyprint " nowrap>node</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Adds the given element to elements if it has an ID.</div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.getId = function(</td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the ID of the specified object. </div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.reference = function(</td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Hook for subclassers to implement a custom method for retrieving IDs from objects. </div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.encode = function(</td><td class="PParameter  prettyprint " nowrap>obj</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Encodes the specified object and returns the resulting XML node.</div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.decode = function(</td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>into</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Decodes the given XML node. </div></div><div class=CToolTip id="tt16"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.encodeCell = function(</td><td class="PParameter  prettyprint " nowrap>cell,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>includeChildren</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Encoding of cell hierarchies is built-into the core, but is a higher-level function that needs to be explicitely used by the respective object encoders (eg. </div></div><div class=CToolTip id="tt17"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.isCellCodec = function(</td><td class="PParameter  prettyprint " nowrap>codec</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns true if the given codec is a cell codec. </div></div><div class=CToolTip id="tt18"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.decodeCell = function(</td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>restoreStructures</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Decodes cells that have been encoded using inversion, ie. </div></div><div class=CToolTip id="tt19"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.insertIntoGraph = function(</td><td class="PParameter  prettyprint " nowrap>cell</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Inserts the given cell into its parent and terminal cells.</div></div><div class=CToolTip id="tt20"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>mxCodec.prototype.setAttribute = function(</td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>attribute,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>value</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Sets the attribute on the specified node to value. </div></div><div class=CToolTip id="tt21"><div class=CClass>Generic codec for JavaScript objects that implements a mapping between JavaScript objects and XML nodes that maps each field or element to an attribute or child node, and vice versa.</div></div><div class=CToolTip id="tt22"><div class=CClass>Singleton class that acts as a global registry for codecs.</div></div><div class=CToolTip id="tt23"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>get: function(</td><td class="PParameter  prettyprint " nowrap>url,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>onload,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>onerror,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>binary,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>timeout,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>ontimeout,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>headers</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Loads the specified URL <b>asynchronously</b> and invokes the given functions depending on the request status. </div></div><div class=CToolTip id="tt24"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">parseXml: function()</td></tr></table></blockquote>Parses the specified XML string into a new XML document and returns the new document.</div></div><div class=CToolTip id="tt25"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getXml: function(</td><td class="PParameter  prettyprint " nowrap>node,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>linefeed</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the XML content of the specified node. </div></div><div class=CToolTip id="tt26"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">createXmlDocument: function()</td></tr></table></blockquote>Returns a new, empty XML document.</div></div><div class=CToolTip id="tt27"><div class=CClass>Cells are the elements of the graph model. </div></div><div class=CToolTip id="tt28"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">mxCell.prototype.getId = function()</td></tr></table></blockquote>Returns the Id of the cell as a string.</div></div><div class=CToolTip id="tt29"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>create: function(</td><td class="PParameter  prettyprint " nowrap>cell</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Creates the cell path for the given cell. </div></div><div class=CToolTip id="tt30"><div class=CClass>Codec for mxGraphModels. </div></div><div class=CToolTip id="tt31"><div class=CClass>Codec for mxChildChanges. </div></div><div class=CToolTip id="tt32"><div class=CClass>Codec for mxRootChanges. </div></div><div class=CToolTip id="tt33"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">codec.isCellCodec = function()</td></tr></table></blockquote>Returns true since this is a cell codec.</div></div><!--END_ND_TOOLTIPS-->




<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>